namespace Storyteller.Framework.Input
{
	public class Keyboard
	{
		public enum Key
		{
			// keycodes found here:
			// http://boredzo.org/blog/wp-content/uploads/2007/05/IMTx-virtual-keycodes.pdf
			A = 0,
			B = 11,
			C = 8,
			D = 2,
			E = 14,
			F = 3,
			G = 5,
			H = 4,
			I = 34,
			J = 38,
			K = 40,
			L = 37,
			M = 46,
			N = 45,
			O = 31,
			P = 35,
			Q = 12,
			R = 15,
			S = 1,
			T = 17,
			U = 32,
			V = 9,
			W = 13,
			X = 7,
			Y = 16,
			Z = 6,

			Escape = 53,
			F1 = 122,
			F2 = 120,
			F4 = 118,
			F3 = 99,
			F5 = 96,
			F6 = 97,
			F7 = 98,
			F8 = 100,
			F9 = 101,
			F10 = 109,
			F11 = 103,
			F12 = 111,
			F13 = 105,
			F14 = 107,
			F15 = 113,

			Tilde = 50,
			D1 = 18,
			D2 = 19,
			D3 = 20,
			D4 = 21,
			D5 = 23,
			D6 = 22,
			D7 = 26,
			D8 = 28,
			D9 = 25,
			D0 = 29,
			Minus = 27,
			Plus = 24,
			Backspace = 51,

			Tab = 48,
			SquareBracketOpen = 33,
			SquareBracketClose = 30,
			Backslash = 42,

			CapsLock = 57,
			Semicolon = 41,
			Quotes = 39,
			Enter = 36,

			LeftShift = 56,
			Comma = 43, LessThan = 43,
			Period = 47, GreaterThan = 47,
			ForwardSlash = 44, Question = 44,
			RightShift = 60,

			LeftControl = 59,
			LeftAlt = 58,
			LeftApple = 55,
			Space = 49,
			RightApple = 54,
			RightAlt = 61,
			RightControl = 62,

			Home = 115,
			End = 119,
			PageUp = 116,
			PageDown = 121,
			// Insert?
			Delete = 117,

			Left = 123,
			Right = 124,
			Down = 125,
			Up = 126,

			NumLock = 71,

			NumPadDivide = 75,
			NumPadMultiply = 67,
			NumPadMinus = 78,
			NumPadPlus = 69,
			NumPadEnter = 76,
			NumPadDecimal = 65,

			NumPad0 = 82,
			NumPad1 = 83,
			NumPad2 = 84,
			NumPad3 = 85,
			NumPad4 = 86,
			NumPad5 = 87,
			NumPad6 = 88,
			NumPad7 = 89,
			NumPad8 = 91,
			NumPad9 = 92,

			MaximumKeyIndex = 127,

			// Unused codes:
			// 10
			// 52
			// 63 - 64
			// 66
			// 68
			// 70
			// 72 - 74
			// 77
			// 79 - 80
			// 90
			// 93 - 95
			// 102
			// 104
			// 106
			// 108
			// 110
			// 112
			// 114
		}

		public static bool IsKeyDown(Key key)
		{
			return Game.Instance.KeyboardState[(int)key];
		}
	}
}